#include <bits/stdc++.h>
using namespace std;
#define ll long long

int jjpow(int, int);
int jjC(ll, ll);

const int MOD = 1e9 + 7;

int n;
int a[110], b[110];
int jjmax, jjmin;

void solve(){
    if(jjmax <= jjmin){
        printf("%d\n", jjmin - jjmax + 1);
    }else{
        printf("0\n");
    }
}

void init(){
    jjmax = -1, jjmin = INT_MAX;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
        if(a[i] > jjmax)
            jjmax = a[i];
    }
    for(int i = 0; i < n; ++i){
        scanf("%d", &b[i]);
        if(b[i] < jjmin)
            jjmin = b[i];
    }
}

int main(){
    #ifndef ONLINE_JUDGE
        auto start_clock = clock();
        //freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    #endif
    
    init();
    solve();
    
    #ifndef ONLINE_JUDGE
        auto end_clock = clock();
        //cout<<"runtime: "<<end_clock - start_clock<<"ms"<<endl;
    #endif
    return 0;
}

int jjpow(int a, int b){
    if(b == 2)return (a * a)%MOD;
    if(b == 1)return a;
    int ret1 = a, ret2 = a;
    int cnt1 = log(b)/log(2);
    int cnt2 = b - pow(2, cnt1);
    ret1 = jjpow(a, cnt2);
    for(int i = 0; i < cnt1; ++i){
        ret2 = (ret2 * ret2)%MOD;
    }
    return (ret1 * ret2)%MOD;
}

int jjC(ll a, ll b){
    int ret = 1, tmp = 1;
    for(int i = a; i > a - b; --i){
        ret = (ret * i)%MOD;
    }
    for(int i = 2; i <= b; ++i){
        tmp = (tmp * i)%MOD;
    }
    return ret/tmp;
}
